import request from "@/utils/request";


export function getAuditEcho(query) {
  return request({
    url: "/ny-iqc/incomingInspection/getAuditEcho",
    method: "get",
    params: query,
  });
}
// 查询检验标准列表
export function inspectionPlan(query) {
  return request({
    url: "/ny-iqc/inspectionPlan/list",
    method: "get",
    params: query,
  });
}

export function deletePlan(ids) {
  return request({
    url: "/ny-iqc/inspectionPlan/" + ids,
    method: "delete",
  });
}

export function getVersion(data) {
  return request({
    url: "/ny-iqc/inspectionPlan/getVersion",
    method: "post",
    data,
  });
}

export function getSamplingPlan(query) {
  return request({
    url: "/ny-iqc/samplingPlan/list",
    method: "get",
    params: query,
  });
}
export function addSamplingPlan(data) {
  return request({
    url: "/ny-iqc/samplingPlan",
    method: "put",
    data,
  });
}

export function delSamplingPlan(ids) {
  return request({
    url: "/ny-iqc/samplingPlan/" + ids,
    method: "delete",
  });
}

export function addInspectionPlan(query) {
  return request({
    url: "/ny-iqc/inspectionPlan",
    method: "post",
    data: query,
  });
}
export function addPlanBatch(query) {
  return request({
    url: "/ny-iqc/inspectionPlan/addBatch",
    method: "post",
    data: query,
  });
}
export function editPlanBatch(query) {
  return request({
    url: "/ny-iqc/inspectionPlan/editBatch",
    method: "put",
    data: query,
  });
}

export function listTemplate(query) {
  return request({
    url: "/ny-iqc/checkItem/listGroup",
    method: "get",
    params: query,
  });
}

export function getItemsByTemplateName(query) {
  return request({
    url: "/ny-iqc/checkItem/getTemplateName",
    method: "get",
    params: query,
  });
}

export function planCopy(id) {
  return request({
    url: "/ny-iqc/inspectionPlan/getCopyId/" + id,
    method: "post",
  });
}

export function planToTemplate(query) {
  return request({
    url: "/ny-iqc/inspectionPlan/getTemplate",
    method: "get",
    params: query,
  });
}

export function templateCopy(params) {
  return request({
    url: "/ny-iqc/checkItem/getCopy",
    method: "post",
    params,
  });
}

export function templateDelete(templateName) {
  return request({
    url: "/ny-iqc/checkItem/" + templateName,
    method: "delete",
  });
}
export function getPlanById(id) {
  return request({
    url: "/ny-iqc/inspectionPlan/" + id,
    method: "get",
  });
}

export function editPlan(data) {
  return request({
    url: "/ny-iqc/inspectionPlan",
    method: "put",
    data,
  });
}

export function addTemplate(data) {
  return request({
    url: "/ny-iqc/checkItem",
    method: "post",
    data,
  });
}

export function editTemplate(data) {
  return request({
    url: "/ny-iqc/checkItem",
    method: "put",
    data,
  });
}

export function getTemplateById(params) {
  return request({
    url: "/ny-iqc/checkItem/getTemplateName",
    method: "get",
    params,
  });
}

export function incomingList(params) {
  return request({
    url: "/ny-iqc/incomingInspection/list",
    method: "get",
    params,
  });
}

export function incomingInfo(id) {
  return request({
    url: "/ny-iqc/incomingInspection/" + id,
    method: "get",
  });
}

export function repertoryList(data) {
  return request({
    url: "/ny-iqc/repertory/list",
    method: "get",
    params: data,
  });
}

export function copyRepertoryList(data) {
  return request({
    url: "/ny-iqc/repertory/getCopyRepertory",
    method: "get",
    params: data,
  });
}

export function getFlowByMaterialCode(params) {
  return request({
    url: "/ny-iqc/minFlaw/listmaterialCode",
    method: "get",
    params,
  });
}

export function addIncoming(data) {
  return request({
    url: "/ny-iqc/incomingInspection/getInspection1",
    method: "post",
    data,
  });
}

export function getAuditCheck(params) {
  return request({
    url: "/ny-iqc/incomingInspection/getAuditCheck",
    method: "post",
    params,
  });
}

export function addMRBIncoming(data) {
  return request({
    url: "/ny-iqc/incomingInspection/getInventory1",
    method: "post",
    data,
  });
}
export function approvalIncoming(data) {
  return request({
    url: "/ny-iqc/incomingInspection/getInspection2",
    method: "post",
    data,
  });
}

export function addNcrIncoming(data) {
  return request({
    url: "/ny-iqc/incomingInspection/getInspection3",
    method: "post",
    data,
  });
}

export function getInspectionCheck(params) {
  return request({
    url: "/ny-iqc/incomingInspection/getInspectionCheck",
    method: "post",
    params,
  });
}

export function getAudit(data) {
  return request({
    url: "/ny-iqc/incomingInspection/getAudit",
    method: "post",
    data,
  });
}

export function getReleaseCheck(params) {
  return request({
    url: "/ny-iqc/incomingInspection/getReleaseCheck",
    method: "post",
    params,
  });
}

export function getReleaseInfo(params) {
  return request({
    url: "/ny-iqc/incomingInspection/getIds",
    method: "get",
    params,
  });
}

export function getRelease(params) {
  return request({
    url: "/ny-iqc/incomingInspection/getRelease",
    method: "post",
    params,
  });
}

export function getCollectionCheck(params) {
  return request({
    url: "/ny-iqc/incomingInspection/getCollectionCheck",
    method: "post",
    params,
  });
}
export function getCollection(data) {
  return request({
    url: "/ny-iqc/incomingInspection/getCollection",
    method: "post",
    data,
  });
}

export function getReturn(params) {
  return request({
    url: "/ny-iqc/incomingInspection/getReturn",
    method: "post",
    params,
  });
}

export function returns(id) {
  return request({
    url: "/ny-iqc/incomingInspection/returnCheck/" + id,
    method: "get",
  });
}

export function getNcrReviewCheck(params) {
  return request({
    url: "/ny-iqc/incomingInspection/getNcrReviewCheck",
    method: "post",
    params,
  });
}
// 获取检验标准历史版本
export function getHistoryPlan(params) {
  return request({
    url: "/ny-iqc/inspectionPlan/getHistoryPlan",
    method: "get",
    params,
  });
}
// 获取检验标准最新版本号
export function getPlanVersion(params) {
  return request({
    url: "/ny-iqc/inspectionPlan/getVersion",
    method: "post",
    params,
  });
}
// 获取检验标准最新版本号
export function getAllVersion(params) {
  return request({
    url: "/ny-iqc/inventory/getCheckoutEcho",
    method: "get",
    params,
  });
}

// 获取检验标准的检验项信息
export function getCheckItem(params) {
  return request({
    url: "/ny-iqc/inspectionPlan/getCheckItem",
    method: "get",
    params,
  });
}

// 检验标准的完成校对
export function getProofread(id) {
  return request({
    url: "/ny-iqc/inspectionPlan/getProofread/" + id,
    method: "get",
  });
}

// 检验标准的完成校对
export function addNcr(data) {
  return request({
    url: "/ny-iqc/incomingInspection/getNcrReview",
    method: "post",
    data,
  });
}

export function getReleaseApproval(data) {
  return request({
    url: "/ny-iqc/incomingInspection/getReleaseApproval",
    method: "post",
    data,
  });
}
export function getAcceptReturns(params) {
  return request({
    url: "/ny-iqc/incomingInspection/getAcceptReturns",
    method: "get",
    params,
  });
}

export function editAcceptReturns(data) {
  return request({
    url: "/ny-iqc/incomingInspection/editAcceptReturns",
    method: "post",
    data,
  });
}

// 检验标准的导入
export function importPlan(data) {
  return request({
    url: "/ny-iqc/inspectionPlan/import",
    method: "post",
    data,
  });
}

// 获取计划中的检验项信息
export function getPlanItem(data) {
  return request({
    url: "/ny-iqc/inventory/getItem",
    method: "get",
    params: data,
  });
}

// 获取小缺陷
export function getMinFlawAll(data) {
  return request({
    url: "/ny-iqc/minFlaw/listAll",
    method: "get",
    params: data,
  });
}

// 选择复制查询列表
export function getDuplicateList(data) {
  return request({
    url: "/ny-iqc/incomingInspection/getDuplicateList",
    method: "get",
    params: data,
  });
}

// 修改检验标准——校验
export function inspectionPlanEditCheck(data) {
  return request({
    url: "/ny-iqc/inspectionPlan/editCheck",
    method: "get",
    params: data,
  });
}

// 旧版本数据列表
export function getOldVersionList(data) {
  return request({
    url: "/ny-iqc/incomingInspection/oldVersionList",
    method: "get",
    params: data,
  });
}

// 旧版本审批
export function editoldVersion(data) {
  return request({
    url: "/ny-iqc/incomingInspection/editoldVersion",
    method: "get",
    params: data,
  });
}

// 获取spa
export function getLot(data) {
  return request({
    url: "/ny-iqc/nlenr/getLot",
    method: "get",
    params: data,
  });
}
// 获取oa
export function getNcrprocessId(data) {
  return request({
    url: "/ny-iqc/nlenr/getNcrprocessId",
    method: "get",
    params: data,
  });
}

// 获取挑选使用list
export function getNlenrList(data) {
  return request({
    url: "/ny-iqc/nlenr/list",
    method: "get",
    params: data,
  });
}

// 统计箱号数量

export function getHuiZong(data) {
  return request({
    url: "/ny-iqc/nlenr/getHuiZong",
    method: "get",
    params: data,
  });
}

// 接收

export function updateDecisionJieshu(data) {
  return request({
    url: "/ny-iqc/nlenr/updateDecisionJieshu/" + data,
    method: "get",
  });
}

// 退货
export function updateDecisionTuiHuo(data) {
  return request({
    url: "/ny-iqc/nlenr/updateDecisionTuiHuo/" + data,
    method: "get",
  });
}

// 来料打印校验
export function getPrintCheck(params) {
  return request({
    url: "/ny-iqc/incomingInspection/getPrintCheck",
    method: "post",
    params,
  });
}

// 完成决策

export function getCompleteDecision(data) {
  return request({
    url: "/ny-iqc/nlenr/getCompleteDecision",
    method: "get",
    params: data,
  });
}

// 完成决策提示

export function getCompleteDecisionHint(data) {
  return request({
    url: "/ny-iqc/nlenr/getCompleteDecisionHint",
    method: "get",
    params: data,
  });
}
export function getIncomingDetail(id) {
  return request({
    url: "/ny-iqc/incomingInspection/incoming/" + id,
    method: "get",
  });
}

// 来料打印校验
export function updateIncoming(data) {
  return request({
    url: "/ny-iqc/incomingInspection/getInspectionForEditSave",
    method: "post",
    data,
  });
}
// 调试SAP
export function updateStatus(data) {
  return request({
    url: "/ny-iqc/inspectionPlan/sendSAP/" + data.id,
    method: "get",
    data,
  });
}

// 调试SAP
export function checkout(data) {
  return request({
    url: "/ny-iqc/repertory/sendSAP/" + data.id,
    method: "get",
    data,
  });
}

// 复核
export function getReview(data) {
  return request({
    url: "/ny-iqc/incomingInspection/getReview",
    method: "get",
    params: data,
  });
}
export function splitInspection(data) {
  return request({
    url: "/ny-iqc/inspectionPlan/split",
    method: "get",
    params: data,
  });
}

export function getApprovalInspectionCheck(data) {
  return request({
    url: "/ny-iqc/inspectionPlan/getApprovalCheck",
    method: "post",
    data,
  });
}



// 检验标准提交
export function getSubmit(data) {
  return request({
    url: "/ny-iqc/inspectionPlan/getSubmit",
    method: "post",
    data
  });
}

// 检验标准审批
export function getApproval(data) {
  return request({
    url: "/ny-iqc/inspectionPlan/getApproval",
    method: "post",
    data,
  });
}

// 检验标准审批
export function getSendBack(data) {
  return request({
    url: "/ny-iqc/inspectionPlan/getSendBack",
    method: "post",
    data,
  });
}
// 获取MRB评审回显
export function getNCRDetail(data) {
  return request({
    url: "/ny-iqc/incomingInspection/getNcrReviewEcho",
    method: "post",
    params: data,
  });
}

export function updateValidityDate(data) {
  return request({
    url: "/ny-iqc/repertory/updateValidityDate",
    method: "post",
    params: data,
  });
}
// 抽样方案列表
export function samplingPlanList(params) {
  return request({
    url: "/ny-iqc/samplingPlan/list",
    method: "get",
    params,
  });
}

// 抽样方案修改范围
export function editScop(data) {
  return request({
    url: "/ny-iqc/samplingPlan/editScop",
    method: "put",
    data
  });
}

// 抽样方案修改范围
export function editAql(data) {
  return request({
    url: "/ny-iqc/samplingPlan/editAql",
    method: "put",
    data
  });
}

// 抽样方案删除
export function deleteSamplingPlan(id) {
  return request({
    url: "/ny-iqc/samplingPlan/"+id,
    method: "delete"
  });
}


// 缺陷抽样方案删除
export function deleteSamplingPlan2(id) {
  return request({
    url: "/ny-iqc/samplingPlan/flaw/"+id,
    method: "delete"
  });
}
export function batchAddInspection(data) {
  return request({
    url: "/ny-iqc/inspectionPlan/addBatch",
    method: "post",
    data,
  });
}

export function batchEditInspection(data) {
  return request({
    url: "/ny-iqc/inspectionPlan/editBatch",
    method: "put",
    data,
  });
}

export function getPlanFile(data) {
  return request({
    url: "/ny-iqc/planfile/getFile",
    method: "post",
    data,
  });
}

export function getReport(params) {
  return request({
    url: "/ny-iqc/incomingInspection/getReport",
    method: "get",
    params,
  });
}

export function getNcrReviewList(params) {
  return request({
    url: "/ny-iqc/ncrReview/list",
    method: "get",
    params,
  });
}
export function materialChart(data) {
  return request({
    url: "/ny-iqc/cockpit/materialChart",
    method: "post",
    data,
  });
}
export function qualifiedChart(data) {
  return request({
    url: "/ny-iqc/cockpit/qualifiedChart",
    method: "post",
    data,
  });
}
export function materialList(data) {
  return request({
    url: "/ny-iqc/cockpit/materialList",
    method: "post",
    data,
  });
}

export function checkStatusChart(data) {
  return request({
    url: "/ny-iqc/cockpit/checkStatusChart",
    method: "post",
    data,
  });
}

export function nonconFormingStatusChart(data) {
  return request({
    url: "/ny-iqc/cockpit/nonconFormingStatusChart",
    method: "post",
    data,
  });
}

export function supplierChart(data) {
  return request({
    url: "/ny-iqc/cockpit/supplierChart",
    method: "post",
    data,
  });
}

export function checkItemClassList(params) {
  return request({
    url: "/ny-iqc/checkItemClass/list",
    method: "get",
    params,
  });
}

export function checkStatusChartDetails(data) {
  return request({
    url: "/ny-iqc/cockpit/checkStatusChartDetails",
    method: "post",
    data,
  });
}
export function qualifiedChartDetails(data) {
  return request({
    url: "/ny-iqc/cockpit/qualifiedChartDetails",
    method: "post",
    data,
  });
}
export function materialChartDetails(data) {
  return request({
    url: "/ny-iqc/cockpit/materialChartDetails",
    method: "post",
    data,
  });
}

export function supplierOneChart(data) {
  return request({
    url: "/ny-iqc/cockpit/supplierOneChart",
    method: "post",
    data,
  });
}

export function getInventoryList(params) {
  return request({
    url: "/ny-iqc/inventory/list",
    method: "get",
    params,
  });
}
// 紧急放行校验
export function checkReleaseApproval(data){
  return request({
    url: "/ny-iqc/incomingInspection/getReleaseApprovalCheck",
    method: "post",
    data
  });
}

export function exportCoa(id){
  return request({
    url: "/ny-iqc/incomingInspection/exportCoa",
    method: "get",
    params:{id},
  });
}


export function checkoutManualAPI(data) {
  return request({
    url: "/ny-iqc/inventory/checkoutManual",
    method: "post",
    data,
  });
}

export function virtuallyCheckoutManualAPI(data) {
  return request({
    url: "/ny-iqc/incomingInspection/virtuallyCheckoutManual",
    method: "post",
    data,
  });
}
export function getSamplingTypeAPI(params) {
  return request({
    url: "/ny-iqc/inventory/getSamplingType",
    method: "get",
    params,
  });
}

export function listScanSampleCodeAPI(params) {
  return request({
    url: "/ny-iqc/incomingInspection/listScanSampleCode",
    method: "get",
    params,
  });
}
export function getVersion2(params) {
  return request({
    url: "/ny-iqc/inventory/getAllVersion",
    method: "get",
    params,
  });
}
export function categorylistAPI(params) {
  return request({
    url: "/qcmasterdata/category/list",
    method: "get",
    params,
  });
}


/**
 * edit barcode
 */
export function saveBarcode(data){
  return request({
    url:"/ny-iqc/incomingInspection/updateScanSampleCode",
    method:'post',
    data
  })
}
/**
 *
 */

export function delBarcode(params){
  return request({
    url:"/ny-iqc/incomingInspection/delScanSampleCode/"+params.id,
    method:'get'
  })
}

export function auditCheck(id) {
  return request({
    url: "/ny-iqc/inspection/audit/check/" + id,
    method: "get",
  });
}

//  inspection/audit/batch 
export function auditBatch(data) {
  return request({
    url: "/ny-iqc/inspection/audit/batch",
    method: "post",
    data,
  });
}


export function audit(data){
  return request({
    url:"/ny-iqc/inspection/audit",
    method:'post',
    data
  })
}
export function listMesBaseDictAPI(params){
  return request({
    url:"/ny-iqc/incomingInspection/listMesBaseDict",
    method:'get'
  })
}
export function inspectionResultPushMesAPI(data){
  return request({
    url:"/ny-iqc/incomingInspection/inspectionResultPushMes",
    method:'post',
    data
  })
}
//raise a produce trial
//cost/investment/approve
export function raiseProduceTrail(data) {
    console.log(data);
    return request({
        url: "/ny-iqc/cost/investment/newAdd",
        method: "post",
        data:{
            listInspectionId:data.ids
        },
    });
}

export function salesReturn(params) {
  return request({
    url: "/ny-iqc/incomingInspection/queryReturn",
    method: "get",
    params,
  });
}





export function getTemplateVersion(id) {
  return request({
    url: "/ny-iqc/checkItem/getTemplateVersion/" + id,
    method: "get",
  });
}

export function getTemplateInfoByVersion(data){
  return request({
    url:"/ny-iqc/checkItem/getTemplateInfoByVersion",
    method:'post',
    data
  })
}

export function push(data){
  return request({
    url:"/ny-iqc/checkItem/push",
    method:'post',
    data
  })
}

export function findRelFactory(data){
  return request({
    url:"/ny-iqc/checkItem/findRelFactory",
    method:'post',
    data
  })
}
export function incomingInspectionPushCrm(params) {
  console.log(params);
  return request({
    url: `/ny-iqc/incomingInspection/pushCrm?ids=${params.toString()}`,
    method: "get"
  });
}


export function inspectionReuse(data){
  return request({
    url:"/ny-iqc/incomingInspection/inspectionReuse",
    method:'post',
    data
  })
}
export function divisionAndBaseList(data){
  return request({
    url:"/qcmasterdata/division/search/divisionAndBaseList",
    method:'get'
  })
}
export function inspectionOKRatio(params){
  return request({
    url:"/ny-iqc/cockpit/inspectionOKRatio",
    method:'get',
    params
  })
}
export function inspectionDivisionBaseRatio(params){
  return request({
    url:"/ny-iqc/cockpit/inspectionDivisionBaseRatio",
    method:'get',
    params
  })
}
export function inspectionBaseMaterialRatio(params){
  return request({
    url:"/ny-iqc/cockpit/inspectionBaseMaterialRatio",
    method:'get',
    params
  })
}
export function inspectionJumpMaterial(params){
  return request({
    url:"/ny-iqc/cockpit/inspectionJumpMaterial",
    method:'get',
    params
  })
}
export function inspectionJumpMaterialSupplier(params){
  return request({
    url:"/ny-iqc/cockpit/inspectionJumpMaterialSupplier",
    method:'get',
    params
  })
}
export function inspectionDivisionMrbRatio(data){
  return request({
    url:"/ny-iqc/cockpit/inspectionDivisionMrbRatio",
    method:'post',
    data:{...data}
  })
}
export function inspectionDivisionSupplierMrbRatio(data){
  return request({
    url:"/ny-iqc/cockpit/inspectionDivisionSupplierMrbRatio",
    method:'post',
    data:{...data}
  })
}
export function inspectionDivisionBaseMrbRatio(data){
  return request({
    url:"/ny-iqc/cockpit/inspectionDivisionBaseMrbRatio",
    method:'post',
    data:{...data}
  })
}
export function inspectionSupplierMrbRatio(data){
  return request({
    url:"/ny-iqc/cockpit/inspectionSupplierMrbRatio",
    method:'post',
    data:{...data}
  })
}
export function inspectionMaterialMrbRatio(data){
  return request({
    url:"/ny-iqc/cockpit/inspectionMaterialMrbRatio",
    method:'post',
    data:{...data}
  })
}

export function inspectionFinishRateByExtra(data){
  return request({
    url:"/ny-iqc/cockpit/inspectionFinishRateByExtra",
    method:'post',
    data:{...data}
  })
}
export function baseInsFinishRateByExtra(data){
  return request({
    url:"/ny-iqc/cockpit/baseInsFinishRateByExtra",
    method:'post',
    data:{...data}
  })
}
export function supplierInsFinishRateByExtra(data){
  return request({
    url:"/ny-iqc/cockpit/supplierInsFinishRateByExtra",
    method:'post',
    data:{...data}
  })
}


// 查询过账数量
export function getPassNumAPI(params) {
  return request({
    url: "/ny-iqc/incomingInspection/getPassNum",
    method: "get",
    params
  });
}
//分批过账
export function splitTransferItemsAPI(params) {
  return request({
    url: "/ny-iqc/incomingInspection/splitTransferItems",
    method: "get",
    params
  });
}
//查询检验批次
export function getExtraByInspectionIdAPI(id) {
  return request({
    url: "/ny-iqc/incomingInspection/getExtraByInspectionId/"+id,
    method: "get"
  });
}


export function divisionRateByExtraAPI(data) {
  return request({
    url: "/ny-iqc/cockpit/divisionRateByExtra",
    method: "post",
    data,
  });
}

export function inspectionCheckResultRatioAPI(data) {
  return request({
    url: "/ny-iqc/cockpit/inspectionCheckResultRatio",
    method: "post",
    data,
  });
}

export function inspectionTaskListApi(params) {
  return request({
    url: "/ny-iqc/cockpit/inspectionTaskList",
    method: "get",
    params,
  });
}

export function mrbListAPI(params) {
  return request({
    url: "/ny-iqc/cockpit/mrbList",
    method: "get",
    params,
  });
}

export function inspectionDecisionRate(data) {
  return request({
    url: "/ny-iqc/cockpit/inspectionDecisionRate",
    method: "post",
    data,
  });
}
export function revokeApprove(data) {
  return request({
    url: "/ny-iqc/inspectionPlan/revokeApprove",//todo 待补充接口
    method: "post",
    data,
  });
}



export function materialInsFinishRateByExtra(data){
  return request({
    url:"/ny-iqc/cockpit/materialInsFinishRateByExtra",
    method:'post',
    data:{...data}
  })
}
export function materialLevel(data){
  return request({
    url:"/ny-iqc/cockpit/materialLevel",
    method:'post',
    data:{...data}
  })
}

//查询检验批次
export function getInfoByInspectionOrderAPI(id) {
  return request({
    url: "/ny-iqc/incomingInspection/getInfoByInspectionOrder/"+id,
    method: "get"
  });
}

//虚拟任务获取当前策略
export function getTacticsCarryOutByCode(params) {
  return request({
    url: "/ny-iqc/incomingInspection/getTacticsCarryOutByCode",
    method: "get",
    params
  });
}

//修改供应商名录
export function updateSupplierAliasName(data) {
  return request({
    url: "/ny-iqc/incomingInspection/updateSupplierAliasName",
    method: "post",
    data
  });
}